<?php
/**
*
* @package ppkBB3cker
* @version $Id: install_update.php 1.000 2010-01-26 15:25:00 PPK $
* @copyright (c) 2010 PPK
* http://www.ppkbb3cker.ru, http://protoneutron.narod.ru
*
*/

error_reporting(0);

define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './../';
$phpEx = substr(strrchr(__FILE__, '.'), 1);

require($phpbb_root_path.'config.'.$phpEx);

if($dbms!='mysql')
{
	err('Only mysql supported');
}

$c=@mysql_connect($dbhost, $dbuser, $dbpasswd);
if(!$c)
{
	err('Error connecting database: '.mysql_error());
}

$s=@mysql_select_db($dbname, $c);
if(!$s)
{
	err('Error selecting database: '.mysql_error());
}

$result=my_sql_query('SELECT VERSION() AS version');
$mv=mysql_fetch_row($result);

$m_version=$mv[0];

if(version_compare($m_version, '4.1.3', '>='))
{
	$mysql_dbms=41;
}
else
{
	$mysql_dbms=40;
}

my_sql_query("SET NAMES 'utf8'");

if($mysql_dbms==41)
{

}
else
{

}

$result=my_sql_query("ALTER TABLE  `{$table_prefix}tracker_rannounces` CHANGE  `tracker`  `tracker` INT( 10 ) UNSIGNED NOT NULL DEFAULT  '0'");

mysql_close();
exit();

function my_sql_query($query, $silent=0)
{
	$result=@mysql_query($query);
	if(!$silent)
	{
		echo ($result ? '<b>Ok</b>: ' : '<span style="color:#FF0000"><b>Error</b>: ').$query.($result ? '' : '</span><br />['.mysql_errno().'] ('.mysql_error().')').'<br /><br />';
	}

	return $result;
}

function err($str)
{
	echo $str;
	mysql_close();
	exit();
}

?>
